﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EzDesk.Apps.Model.Attendance;
using EzDesk.Utility.Web.ViewModels;
using EzDesk.Utility.Web.Extensions;
using EzDesk.Core.Model;

namespace EzDesk.Clients.DesktopWeb.Attendance.ViewModel
{
    public class LeaveInfoModel:ViewModelBase
    {
        public LeaveInfoModel(LeaveInfo leaveInfo)
        {
            this.User = this.GetEzApiClient().GetSimpleUserById(leaveInfo.UserId);
            this.AuditUser = this.GetEzApiClient().GetSimpleUserById(leaveInfo.AuditUserId);

            this.Id = leaveInfo.Id;
            this.LeaveTypeId = leaveInfo.LeaveTypeId;
            this.LeaveTypeName = leaveInfo.LeaveTypeName;
            this.StartTime = leaveInfo.StartTime;
            this.EndTime = leaveInfo.EndTime;
            this.Description = leaveInfo.Description;
            this.IsAudited = leaveInfo.IsAudited;
            this.AuditNote = leaveInfo.AuditNote;
            this.AuditTime = leaveInfo.AuditTime;
            this.IsForWork = leaveInfo.IsForWork;
            this.IsAgreed = leaveInfo.IsAgreed;
            this.CreateTime = leaveInfo.CreateTime;
        }

        public Guid Id { get; set; }
        public Guid LeaveTypeId { get; set; }
        public string LeaveTypeName { get; set; }
        public SimpleUser User { get; set; }

        public DateTime StartTime { get; set; }
        public DateTime EndTime { get; set; }
        public string Description { get; set; }
        public bool IsAudited { get; set; }
        public SimpleUser AuditUser { get; set; }
        public string AuditNote { get; set; }
        public DateTime AuditTime { get; set; }
        public bool IsForWork { get; set; }
        public bool IsAgreed { get; set; }
        public DateTime CreateTime { get; set; }
    }
}